package com.dji.common.utils;

import java.awt.Font;
import java.awt.FontFormatException;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;

public class FontUtil{
	public static Font getDefinedFont(String fontName){
		Font definedFont=null;
		if(fontName!=null){
			InputStream is=null;
			BufferedInputStream bis=null;
			try{
				definedFont=Font.createFont(Font.BOLD,new File("D:/myworkspace/FingerClient/souce/font/"+fontName));
				definedFont=definedFont.deriveFont(30);
			}catch(FontFormatException e){
				e.printStackTrace();
			}catch(IOException e){
				e.printStackTrace();
			}finally{
				try{
					if(null!=bis){
						bis.close();
					}
					if(null!=is){
						is.close();
					}
				}catch(IOException e){
					e.printStackTrace();
				}
			}
		}
		return definedFont;
	}
}
